/*
 *  World.h
 *  lab3
 *
 *  Created by Fredrik Gustafsson on 11/17/10.
 *  Copyright 2010 Kungliga Tekniska Högskolan. All rights reserved.
 *
 */

#ifndef _WOK2_WORLD
#define _WOK2_WORLD

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "Item.h"
#include "Key.h"
#include "Jar.h"
#include "Inside.h"
#include "Outside.h"
#include "Forest.h"
#include "Human.h"
#include "Monster.h"

namespace wok2 {
	class World {
		typedef bool (World::*Command) ();
		std::map<std::string,Command > world_commands;
		std::map<std::string,Environment*> environments;
		
		Environment* current_enviroment;
		Environment* goal_environment;
		Human* player;
		
		std::string welcome_message;
		
		bool go();
		bool take();
		bool drop();
		bool eat();
		bool display_inventory();
		bool display_room();
		bool fight();
		bool quit();
		bool talk();
		bool save();
		bool load();
	public:
		World();
		~World();
		bool parseWorld();
		void runWorldParser();
		void init_world();
		void dealloc_world();
		bool read_world(std::istream& ifs);
		friend std::ostream& operator<<(std::ostream& os, World& w);
		bool write_world(std::ostream& os);
		friend std::istream& operator>>(std::istream& is, World& w);
	};
}

#endif